<?php

namespace app\api\controller\admin;

use app\common\controller\Api;
use app\api\service\admin\AuthService;

class AuthController extends Api
{
    protected $noNeedLogin = ['login'];// 无需登录，也不验证权限
    protected $noNeedRight = ['login', 'logout'];
    
    /**
     * 管理员登录
     */
    public function login()
    {
        $data = $this->request->post();
        $res = AuthService::login($data);
        return json($res);
    }


    /**
     * 退出登录
     */
    public function logout()
    {
        $res = AuthService::logout();
        return json($res);
    }

    /**
     * 个人信息
     */
    public function userinfo()
    {
        $res = AuthService::userinfo();
        return json($res);
    }
}